//
//  CC_ClassifyImageLabel_CollectionViewCell.m
//  HimalayaMountain
//
//  Created by dllo on 16/7/15.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "CC_ClassifyImageLabel_CollectionViewCell.h"  // 这个已经变成 横着的那个啦啦啦啦啦啦啦啦啦啦!!!!!!!!!!!
#import "CCBaceHeaderImageView.h"
#import "CCBaseMainTitleLabel.h"
#import "CC_Classify_Model.h"


@interface CC_ClassifyImageLabel_CollectionViewCell ()

@property(nonatomic, retain) CCBaceHeaderImageView *cricleView;
@property(nonatomic, retain) CCBaseMainTitleLabel *titleLabel;

@end



@implementation CC_ClassifyImageLabel_CollectionViewCell

- (void)dealloc
{
    [_cricleView release];
    [_titleLabel release];
    [super dealloc];
}


-(instancetype)initWithFrame:(CGRect)frame{
    if (self = [super initWithFrame:frame]) {
        self.cricleView = [[CCBaceHeaderImageView alloc]init];
//        self.cricleView.backgroundColor = [UIColor yellowColor];
        [self.contentView addSubview:_cricleView];
        [_cricleView release];
        
        self.titleLabel = [[CCBaseMainTitleLabel alloc]init];
//        self.titleLabel.backgroundColor = [UIColor redColor];
        [self.contentView addSubview:_titleLabel];
        [_titleLabel release];
        
    }
    return self;
}

-(void)layoutSubviews{
    [super layoutSubviews];
    
    //CGSizeMake(SCREENWIDTH  / 2, SCREENHEIGHT * 0.25 / 3);

     [self.cricleView mas_makeConstraints:^(MASConstraintMaker *make) {
         make.size.mas_equalTo(CGSizeMake(SCREENHEIGHT * 0.25 / 3 * 0.6, SCREENHEIGHT * 0.25 / 3 * 0.6));
         make.bottom.equalTo(self.contentView.mas_bottom).offset(-SCREENHEIGHT * 0.25 / 3 * 0.2);
         make.left.equalTo(self.contentView.mas_left).offset(SPACED * 5);
     }];
   
    [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.contentView.mas_top).offset(SCREENHEIGHT * 0.25 / 3 * 0.2);
        make.left.equalTo(self.cricleView.mas_right).offset(SPACED);
        make.bottom.equalTo(self.contentView.mas_bottom).offset(-SCREENHEIGHT * 0.25 / 3 * 0.2);
        make.right.equalTo(self.contentView.mas_right).offset(SPACED);

    }];
 
}


-(void)setClassifyModel:(CC_Classify_Model *)classifyModel{
    
    if (_classifyModel != classifyModel) {
        [_classifyModel release];
        _classifyModel = [classifyModel retain];
    }

    [self.cricleView setImageWithURL:[NSURL URLWithString:classifyModel.coverPath] placeholderImage:PLACEHOLDERIMAGE];
    self.titleLabel.text = classifyModel.title;
    
}



@end
